package com.childguo.controller;

import com.childguo.pojo.Stu;
import com.childguo.services.StuServices;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class HelloController {
    @Autowired
    StuServices ss;
    @ResponseBody
    @RequestMapping("/hello")
    public String hello(){
        return "Hello Spring";
    }

    @RequestMapping("/stu/{id}")
    @ResponseBody
    public Stu SelectStuById(@PathVariable Integer id){
        return ss.findById(id);
    }

}
